Skip to content

fix(android): apply a plugin's own buildscript.gradle in its aar build - #6216

Open
edusperoni wants to merge 1 commit into
mainfrom
fix/plugin-own-buildscript-gradle
Open

edusperoni wants to merge 1 commit into
mainfrom
fix/plugin-own-buildscript-gradle

Conversation

@edusperoni

@edusperoni edusperoni commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

PR Checklist

What is the current behavior?

When the CLI builds a plugin's Android sources into an .aar, it uses the template in vendor/gradle-plugin/build.gradle. That template applies the platforms/android/buildscript.gradle of each plugin the plugin depends on, but never the plugin's own buildscript.gradle.

There is a step meant for that ($rootDir/buildscript.gradle, added in #5555), but $rootDir is the temporary build folder and the CLI never copies the plugin's buildscript.gradle into it, so the step has never run. As a result, anything a plugin puts on the build classpath (a Gradle plugin, a library its copied dependencies {} block uses) is missing from its own .aar build, while it works in the app build and in builds of plugins that depend on it.

What is the new behavior?

The template applies the plugin's own platforms/android/buildscript.gradle in its .aar build, next to its dependencies' files, and the dead $rootDir/buildscript.gradle step is removed (if the CLI ever copied that file, the plugin's script would have been applied twice).

This changes the build of every plugin that ships a buildscript.gradle, so it belongs in the release notes: that file now also runs in the plugin's own .aar build, a separate Gradle project. I checked every buildscript.gradle I could find (firebase core / messaging / crashlytics / performance, sentry, ui-webview, gesturehandler): they only add repositories and classpath entries, sentry also reads one optional property. firebase-core, firebase-performance and sentry build as their own .aar with their real buildscript.gradle, with unchanged Android Gradle plugin and Kotlin versions on the classpath.

Split out of #6175, where org.nativescript:gradle-api relies on this to be usable inside a plugin's own .aar build.

Summary by CodeRabbit

  • Chores
    • Updated where the Android plugin loads its build configuration from. The plugin now uses the configuration in its resolved Android platform directory, while retaining the existing check that the configuration is present before applying it. This change affects build setup and does not introduce a new end-user feature.

The plugin-build template applied the buildscript.gradle of the plugin's
dependencies but never the plugin's own. Its $rootDir/buildscript.gradle step
was meant for that, but the CLI never copies the file into the temporary build
folder, so the step never ran. A plugin's Gradle classpath additions (Gradle
plugins, libraries its copied dependencies {} block uses) are now available in
its own aar build too.

This changes the build of every plugin that ships a buildscript.gradle: that
file now also runs in the plugin's own aar build.
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Gradle plugin build now looks for buildscript.gradle in the resolved Android platform directory. If the file exists, the build applies it and logs it as the plugin’s own script.

Changes: Gradle plugin build

Layer / File(s) Summary
Buildscript lookup
vendor/gradle-plugin/build.gradle
The build now checks getDepPlatformDir(pluginData)/buildscript.gradle and logs the file as the plugin’s own script. It applies the script if it exists.

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Possibly related PRs

Suggested reviewers: farfromrefug, rigor789

Merge Risk: Minimal · up to 02cf8

This change makes plugin builds apply the plugin's own buildscript.gradle from its Android platform directory instead of a root-level file that was never copied. No concrete defect was found, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: the Android plugin AAR build now applies the plugin's own buildscript.gradle. The raw summary confirms the build.gradle change loads the plugin's buildscript.gradle fr…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the Android plugin AAR build now applies the plugin's own buildscript.gradle. The raw summary confirms the build.gradle change loads the plugin's buildscript.gradle from the platform directory instead of $rootDir/buildscript.gradle. The fix(android) prefix and the 70-character length are acceptable. The title is specific and matches the changeset, so it passes.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the buildscript path,
Where platform files are found.
If the plugin’s script exists,
It joins the build without a fuss.
Then hops along its way.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6df2e96b-a885-41fb-ab97-2c00a1e62c23
Commits

Reviewing files that changed from the base of the PR and between c7e0c5b and 02cf841.

Files selected for processing: 1

  • vendor/gradle-plugin/build.gradle

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant